﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TodoApp.Data;
using TodoApp.Models;
using TodoApp.Repository;


namespace TodoApp.Services
{
    public class TodoService:ITodo
    {
        private TodoItemRepos _repos;
        public TodoService(TodoContext db,TodoItemRepos repos)
        {
            _repos = repos;
            _repos.DbContext = db;
        }

        public List<RescueApply> QueryAllItems()
        {
            return _repos.FindList<RescueApply>().ToList();
        }

        public RescueApply FindById(int id)
        {
            return _repos.FindEntity<RescueApply>(s => s.Id == id);
        }

        public int Insert(RescueApply item)
        {
            return _repos.Insert(item);
        }
        public int Update(RescueApply item)
        {
            return _repos.Update(item);
        }
        public int Delete(RescueApply item)
        {
            return _repos.Delete(item);
        }
    }
}
